<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .box{
            width: 100px;
            height: 30px;
            background-color: pink;
        }
        .red{
            background-color: red;
        }
        .yellow{
            background-color: yellow;
        }
        .blue{
            background-color: blue;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 1.直接赋值一个变量 -->
        <div :class="classname">box</div>

        <!-- 2.在两个类名之间选择一个 -->
        <ul>
            <li :class="item % 2 == 1 ? 'red' : 'yellow'" v-for="(item) in 6">{{item}}</li>
        </ul>

        <!--
             3.在多个类名之间选择一个
            <html标签 :class="{ 类名:布尔值,类名:布尔值........ }"></html标签>
        -->
        <ul>
            <li :class="{'red':item % 3 == 1,blue:item % 3 == 2, yellow: item % 3 == 0}" v-for="(item) in 15">{{item}}</li>
        </ul>
    </div>
</body>
<script>
    new Vue({
        el:'#app',
        data:{
            classname:'box'
        }
    })
</script>
</html>